package com.guodi.map.feign;

import com.guodi.map.entity.MapDivision;
import com.guodi.map.entity.MapProjectDir;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


/**
* @描述: map-feign
* @作者: 代鹏刚
* @日期: 2021/1/20 10:25
**/
@FeignClient(
	value = "onemap-map",
	fallback = IMapClientFallback.class
)
public interface IMapClient {

	String API_PREFIX = "/client";
	String MAP_ALL_DIVISION = API_PREFIX + "/mapAllDivision";
	String MATE_BY_CODE = API_PREFIX + "/mateByCode";
	String FIND_BY_CODE = API_PREFIX + "/findByCode";
	String LIST_TREE_BY_CODE_AND_PARENT_ID = API_PREFIX + "/listTreeByCodeAndParentId";
	String CREATE_TREE = API_PREFIX + "/createTree";
	String GET_BY_LAYER_ID = API_PREFIX + "/getByLayerId";
	String SAVE_MTR_MONITOR_REPORT = API_PREFIX + "/saveMtrMonitorReport";
	String GET_MTR_MONITOR_REPORT_LIST = API_PREFIX + "/getMtrMonitorReportList";
	String GET_MTR_DATA_REPORT_LIST = API_PREFIX + "/getMtrDataReportList";
	String GET_MTR_FILE_REPORT_LIST = API_PREFIX + "/getMtrFileReportList";
    String MAP_DIVISION_CODE_2_NAME = API_PREFIX + "/mapDivisionCode2Name";
    String GET_NAME_BY_CODE = API_PREFIX + "/getNameByCode";
    String LIST_DATA_BY_CODE = API_PREFIX + "/listDataByCode";

	/**
	 * @描述: 查询全部行政区划
	 * @入参:
	 * @出参: key -- 区划编码，value -- 区划名称
	 * @作者: 陈宏成
	 * @日期: 2022-01-20
	 */
	@PostMapping(MAP_ALL_DIVISION)
	Map<String, String> mapAllDivision();

	/**
	 * @描述: 根据code获取行政区划，只获取行政区划自己
	 * @入参:
	 * @出参:
	 * @作者: 陈宏成
	 * @日期: 2021/2/3 11:09
	 */
	@PostMapping(MATE_BY_CODE)
    MapDivision mateByCode(@RequestParam("divisionCode") String divisionCode);

	/**
	* @描述: 根据code获取行政区划
	* @入参:
	* @出参:
	* @作者: 代鹏刚
	* @日期: 2021/1/20 10:35
	*/
	@PostMapping(FIND_BY_CODE)
	List<MapDivision> findByCode(@RequestParam("divisionCode") String divisionCode);

	/**
	* @描述: 根据code、父节点ID获取专题目录树
	* @入参:
	* @出参:
	* @作者: 代鹏刚
	* @日期: 2021/1/20 10:37
	**/
	@PostMapping(LIST_TREE_BY_CODE_AND_PARENT_ID)
	List<MapProjectDir> listTreeByCodeAndParentId(@RequestParam("projectCode") String projectCode, @RequestParam("parentId") String parentId, @RequestParam("isDir") Boolean isDir);

	/**
	* @描述: 专题构造树
	* @入参:
	* @出参:
	* @作者: 代鹏刚
	* @日期: 2021/1/20 10:42
	**/
	@PostMapping(CREATE_TREE)
	List<MapProjectDir> createTree(@RequestParam("parentId") String parentId, @RequestBody List<MapProjectDir> mapProjectDirs);

	/**
	 * @描述: 根据区划编码, 获取编码->名字的map
	 * @入参:
	 * @出参:
	 * @作者: 余家鑫
	 * @日期: 2021/6/24 上午9:27
	 */
    @PostMapping(MAP_DIVISION_CODE_2_NAME)
    Map<String, String> mapDivisionCode2Name(@RequestParam("divisionCodes") String[] divisionCodes);

    /**
     * @描述: 根据code获取数据
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/6/24 上午9:31
     */
    @PostMapping(GET_NAME_BY_CODE)
    String getNameByCode(@RequestParam("code") String code);

    /**
     * @描述:
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/6/24 上午9:35
     */
    @PostMapping(LIST_DATA_BY_CODE)
    List<MapDivision> listDataByCode(@RequestParam("code") String code);
}
